package com.baidu.day01;

/**
 * Create with Intellij IDEA
 *
 * @Author Q
 * @date 2021/11/22/15:16
 */
public class StringDemo {
    public static void main(String[] args) {

        System.out.println(1+2+""+3+3);//333

        //1. API使用 - 简单
        //2. 各种字符的比较 - 底层
        String s1 = new String("abc");
        String s2 = new String("abc");
        System.out.println(s1 == s2);//false

        String s3 = "abc";

        System.out.println(s2 == s3);//false

        String s4 = "abc";

        System.out.println(s3 == s4);//true

        //String s5 = "a";

        final String s5 = "a";
        String s6 = s5 + "b";

        String s8 = "a" + "b";

        String s7 = "ab";
        //System.out.println(s7 == s6);//false
        System.out.println(s7 == s6);//true

        System.out.println(s8 == s7);//true
    }
}